package dev.loong.boot3.component;

import dev.loong.boot3.pojo.User;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class RabbitMessageReceiver {
    // 定义监听字符串消息队列名称
    @RabbitListener(queues = {"${rabbitmq.queue.msg}"})
    public void receiveMsg(String msg) {
        System.out.println("收到消息：【" + msg + "】");
    }
    // 定义监听对象消息队列名称
    @RabbitListener(queues = {"${rabbitmq.queue.user}"})
    public void receiveUser(User user) {
        System.out.println("收到用户：【" + user + "】");
    }
}
